<%
  if @order.items_count == 1
    application = 'application'
    file = 'file'
    key = 'KEY'
  else
    application = 'applications'
    file = 'files'
    key = 'KEYS'
  end

  coupons = @order.promo_coupons

  if coupons.length > 0
    vc_coupons = coupons.compact()
    vc_coupons.reject!{|x| x.product_code != 'vc'}
  end
-%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title><%=$STORE_PREFS['company_name']%> Receipt</title>
    <style type="text/css">
	.page { background-color: white; width:550px; }
	img { border: 0; }
	h3 { margin-top: 30px; }
	p { font-family: helvetica, sans-serif; font-size: 13px; line-height: 18px; margin-top: 10px; }
	p.ps, li { font-family: helvetica; font-size: 12px; line-height: 18px; }
	pre { padding:10px; background-color:#eee; }
	div.d { height:1px; margin:20px 0 10px; border-top:1px dotted #999; }
	div.s { height:1x; margin: 20px 0 10px; }
    </style>
</head>
<body>
<div class="page">
    <div class="clear"></div>
    <div id="content">
	<p>Dear <%= h @order.name %>,</p>

	<p>
	    Thank you for purchasing <%=$STORE_PREFS['company_name']%> software. Your license keys are below. If you already have the <%= application %>
	    installed, you can activate by clicking the "Activate Now" link.
	</p>

	<h3>LICENSE <%= key %></h3>
<% for item in @order.line_items -%>
<pre>
<%=item.product.name%>:
<%= item.license_key %> <a href="<%= item.product.license_url_scheme %>://<%= item.license_key %>">Activate Now</a>
</pre>
<% end -%>

	<div class="s"></div>
	<p>Please let us know if you have any questions or comments. Enjoy your purchase.</p>
  
	<p>- <%=$STORE_PREFS['company_name']%></p>
  
	<div class="d"></div>
	<%= render :partial => '../store/order/receipt', :order => @order %>

	<% if coupons && coupons.length > 0 -%>
	<div class="d"></div>
	<h3>COUPONS</h3>
	<%   if vc_coupons.length != 0 -%>
	<p>
	    If you have friends who might enjoy Voice Candy, here are 3 coupon
	    codes for $3 off their purchases. They expire in 15 days.
	</p>
	<pre><%= vc_coupons.collect {|x| x.coupon}.join(',  ') %></pre>
	<%   end -%>
	<% end -%>
    </div>
</div>
</body>
</html>

